//
//  UseInstrduce.swift
//  Skeleton
//
//  Created by hubin on 2025/7/12.
//

import Foundation

/**
 // 单个视图
 view.showSkeleton()
 view.hideSkeleton()
 
 // 整个视图树
 view.showSkeletonForAllSubviews()
 view.hideSkeletonForAllSubviews()
 
 // 视图控制器
 viewController.showSkeleton()
 viewController.hideSkeleton()
 
 // 交错动画
 view.showSkeletonWithStaggeredAnimation(delay: 0.2)
 */

/**
 // 自定义配置
 var customConfig = SkeletonConfig()
 customConfig.baseColor = .systemGray5
 customConfig.highlightColor = .systemGray6
 customConfig.skeletonLineHeight = 14
 customConfig.maxSkeletonLines = 2
 
 // 应用自定义配置
 view.showSkeleton(config: customConfig)
 
 // 自定义骨架形状
 let circlePath = UIBezierPath(ovalIn: view.bounds)
 view.setCustomSkeletonShape(circlePath)
 */

/**
 class FeedViewController: UIViewController {
 @IBOutlet weak var tableView: UITableView!
 
 func loadData() {
 // 显示整个视图控制器的骨架效果
 showSkeleton()
 
 APIService.fetchFeed { [weak self] posts in
 guard let self = self else { return }
 
 // 隐藏骨架效果
 self.hideSkeleton()
 
 // 更新UI
 self.tableView.reloadData()
 }
 }
 }
 */

/**
 class ProfileViewController: UIViewController {
 // ... IBOutlets ...
 
 override func viewDidLoad() {
 super.viewDidLoad()
 
 // 应用自定义层级配置
 var config = SkeletonConfig()
 config.colorDepthFactor = 0.75 // 更强的层级对比
 config.animationDelayDepthFactor = 0.15 // 更明显的动画延迟
 
 // 显示骨架效果
 showSkeleton(config: config)
 
 loadProfileData()
 }
 }
 */

/**
 class CardView: UIView {
 // ... 子视图 ...
 
 func showLoading() {
 // 应用交错动画增强视觉效果
 headerView.showSkeletonWithStaggeredAnimation(delay: 0.0)
 titleLabel.showSkeletonWithStaggeredAnimation(delay: 0.1)
 contentView.showSkeletonWithStaggeredAnimation(delay: 0.2)
 actionButton.showSkeletonWithStaggeredAnimation(delay: 0.3)
 }
 }
 */


/**
 // MARK: - 示例用法
 class InstagramPostCell: UITableViewCell {
     @IBOutlet weak var avatarImageView: UIImageView!
     @IBOutlet weak var usernameLabel: UILabel!
     @IBOutlet weak var postImageView: UIImageView!
     @IBOutlet weak var captionLabel: UILabel!
     @IBOutlet weak var likeButton: UIButton!
     @IBOutlet weak var commentButton: UIButton!
     @IBOutlet weak var shareButton: UIButton!
     
     func showSkeletonLoading() {
         // 对整个单元格应用骨架效果
         showSkeletonForAllSubviews()
         
         // 为按钮添加交错动画
         likeButton.showSkeletonWithStaggeredAnimation(delay: 0.1)
         commentButton.showSkeletonWithStaggeredAnimation(delay: 0.2)
         shareButton.showSkeletonWithStaggeredAnimation(delay: 0.3)
     }
 }
 */

/**
 class ProfileViewController: UIViewController {
     @IBOutlet weak var headerView: UIView!
     @IBOutlet weak var avatarImageView: UIImageView!
     @IBOutlet weak var nameLabel: UILabel!
     @IBOutlet weak var bioLabel: UILabel!
     @IBOutlet weak var statsContainer: UIView!
     @IBOutlet weak var followButton: UIButton!
     
     func loadProfileData() {
         // 显示骨架效果
         showSkeleton()
         
         // 模拟网络请求
         DispatchQueue.global().async {
             // 数据加载...
             DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
                 // 隐藏骨架效果
                 self.hideSkeleton()
                 
                 // 更新UI
                 self.avatarImageView.image = UIImage(named: "user_avatar")
                 self.nameLabel.text = "John Doe"
                 self.bioLabel.text = "iOS Developer | Photographer"
                 self.followButton.setTitle("Follow", for: .normal)
             }
         }
     }
 }

 */
